package at.jaki.ubb.crawling.demo.dataFinder;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import at.jaki.ubb.crawling.api.DataFinder;
import at.jaki.ubb.crawling.model.DataFinderResult;
import at.jaki.ubb.crawling.model.Target;
import at.jaki.ubb.crawling.stlib.dataFinder.BabylonTranslator;

/**
 * Class used to split the targets, so more then one searcher can use them.
 * 
 * @author Attila Jakabfi
 * 
 */
public class TargetSplitter implements DataFinder<String, String, String> {

	public DataFinderResult<String, String> findData(Target<String> t) {

		Collection<Target<String>> targetCollection = new ArrayList<Target<String>>(2);
		targetCollection.add(new Target<String>(t.getPriority(), 1 + t.getId(), MediafaxSearcher.INPUT_TYPE, t.getValue()));
		targetCollection.add(new Target<String>(t.getPriority(), 2 + t.getId(), RealitateaSearcher.INPUT_TYPE, t.getValue()));
		return new DataFinderResult<String, String>(null, targetCollection);
	}

	public void init() {
	}

	public Collection<String> getTypes() {
		return Collections.singletonList(BabylonTranslator.TARGET_TYPE);
	}

}
